package com.lagou.edu.service;

import com.lagou.edu.service.fallback.CodeFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Service
@FeignClient(name = "lagou-service-code")
public interface CodeFeignClient {

    /**
     * 发送验证码到邮箱
     *
     * @param email
     * @return
     */
    @RequestMapping(value = "/api/code/create/{email}", method = RequestMethod.GET)
    Boolean create(@PathVariable(value = "email") String email);

    /**
     * 校验邮箱和验证码
     *
     * @param email
     * @param code
     * @return
     */
    @RequestMapping(value = "/api/code/validate/{email}/{code}", method = RequestMethod.GET)
    Boolean validate(@PathVariable(value = "email") String email, @PathVariable(value = "code") String code);
}
